package com.zjsd.sqeybusiness.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.zjsd.sqeybusiness.domain.Accountlocus;
import com.zjsd.sqeybusiness.service.IAccountlocusService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 充值消费记录Controller
 *
 * @author Zheng
 * @date 2025-03-11
 */
@RestController
@RequestMapping("/sqeybusiness/accountlocus")
public class AccountlocusController extends BaseController
{
    @Autowired
    private IAccountlocusService accountlocusService;

    /**
     * 查询充值消费记录列表
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:accountlocus:list')")
    @GetMapping("/list")
    public TableDataInfo list(Accountlocus accountlocus)
    {
        startPage();
        List<Accountlocus> list = accountlocusService.selectAccountlocusList(accountlocus);
        return getDataTable(list);
    }

    /**
     * 导出充值消费记录列表
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:accountlocus:export')")
    //@Log(title = "充值消费记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Accountlocus accountlocus)
    {
        List<Accountlocus> list = accountlocusService.selectAccountlocusList(accountlocus);
        ExcelUtil<Accountlocus> util = new ExcelUtil<Accountlocus>(Accountlocus.class);
        return util.exportExcel(list, "accountlocus");
    }

    /**
     * 获取充值消费记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:accountlocus:query')")
    @GetMapping(value = "/{locusid}")
    public AjaxResult getInfo(@PathVariable("locusid") Long locusid)
    {
        return AjaxResult.success(accountlocusService.selectAccountlocusById(locusid));
    }

    /**
     * 新增充值消费记录
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:accountlocus:add')")
    //@Log(title = "充值消费记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Accountlocus accountlocus)
    {
        return toAjax(accountlocusService.insertAccountlocus(accountlocus));
    }

    /**
     * 修改充值消费记录
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:accountlocus:edit')")
    //@Log(title = "充值消费记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Accountlocus accountlocus)
    {
        return toAjax(accountlocusService.updateAccountlocus(accountlocus));
    }

    /**
     * 删除充值消费记录
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:accountlocus:remove')")
    //@Log(title = "充值消费记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{locusids}")
    public AjaxResult remove(@PathVariable Long[] locusids)
    {
        return toAjax(accountlocusService.deleteAccountlocusByIds(locusids));
    }
}
